package com.caj.controller;

import com.alibaba.fastjson.JSONObject;
import com.caj.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController {

    @Autowired
    private OrderService orderService;

    @GetMapping("/order")
    public String order(@RequestParam long userId){
        JSONObject info = orderService.order(userId);
        return info.toJSONString();
    }

    @GetMapping("/orderMultiThread")
    public String orderMultiThread(@RequestParam long userId){
        JSONObject info = orderService.orderMultiThread(userId);
        return info.toJSONString();
    }
}
